package com.example.demo.huawei;

// 按身高和体重排序
//4
//100 100 120 130
//40 30 60 50
//输出
//2 1 3 4

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;

public class Main62 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        int[] w = new int[n];
        sc.nextLine();
        String sH = sc.nextLine();
        String sW = sc.nextLine();
        String[] split = sH.split("\\s");
        String[] split1 = sW.split("\\s");
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(split[i]);
            w[i] = Integer.parseInt(split1[i]);
            list.add(i + 1);
        }
        System.out.println(Arrays.toString(h));
        System.out.println(Arrays.toString(w));

        list.sort((o1, o2) -> {
            if (h[o1 - 1] == h[o2 - 1] && w[o1 - 1] == w[o2 - 1]) {
                return o1 - o2;
            } else if (h[o1 - 1] == h[o2 - 1]) {
                return w[o1 - 1] - w[o2 - 1];
            } else {
                return h[o1 - 1] - h[o2 - 1];
            }
        });
        StringBuilder s = new StringBuilder();
        for (Integer i : list) {
            s.append(i).append(" ");
        }
        System.out.println(s.deleteCharAt(s.length() - 1));
    }
}
